<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="维修管理" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "设备编号"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="equipmentCode" value="${warehouse.equipmentCode}" type="text" readonly >


                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "设备名称"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>

                        <input class="form-control" name="equipmentName" value="${warehouse.equipmentName}"  type="text" readonly >
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "设备型号"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="equipmentModel" value="${warehouse.equipmentModel}"  type="text" readonly >
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "单位"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="meteringUnit" value="${warehouse.meteringUnit}"  type="text" readonly >
                </div>
            </div>
        </div>

    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "借出日期"/>：</label>
                <div class="col-sm-8">

                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input type="text" class="time-input" id="lendTime" placeholder="借出日期"
                               value="${warehouse.lendTime?string('yyyy-MM-dd HH:mm:ss')}" name="lendTime"
                               data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>

                        <!--readonly="true"-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "借用部门"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input class="form-control" name="borrowDepartment" value="${warehouse.equipmentCode}"  type="text"  >
                        <!--<input class="form-control time-input" name="borrowDepartment"  data-type="date" data-format="yyyy-MM-dd HH:mm:ss" type="text"  required>-->
                        <!--readonly="true"-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "借用人"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="borrower" value="${warehouse.borrower}"  type="text"  >
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "登记人"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="registrant" value="${warehouse.registrant}"  type="text"  >
                </div>
            </div>
        </div>

    </div>
    <!--<div class="row">-->
        <!--<div class="col-sm-6">-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "归还日期"/>：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<div class="input-group date">-->
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <!--<input type="text" class="time-input" id="returnTime" placeholder="借出日期"-->
                               <!--value="${warehouse.returnTime?string('yyyy-MM-dd HH:mm:ss')}" name="returnTime"-->
                               <!--data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>-->

                        <!--&lt;!&ndash;readonly="true"&ndash;&gt;-->
                    <!--</div>-->

                <!--</div>-->
            <!--</div>-->
        <!--</div>-->

        <!--<div class="col-sm-6">-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "归还人"/>：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input class="form-control" name="returnee" value="${warehouse.returnee}"  type="text"  >-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <div class="row">
        <!--<div class="col-sm-6">-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "验收人"/>：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input class="form-control" name="checks" value="${warehouse.checks}"  type="text"  >-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "备注"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="remark" value="${warehouse.remark}"  type="text"  >
                </div>
            </div>
        </div>
    </div>

</div>

</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">
    <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>
</div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "bus/warehouse";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function tep() {
        opt.layer.open({
            type: 1,
            area: ['580px', '180px'],
            title: '<i class="fa fa-upload"></i> 选择 ',
            shade: 0.3,
            shadeClose: true,
            resize: false,
            scrollbar: true,
            content: opt.template('add1'),
        });
    }

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "equipmentCode"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];

            $("input[name=equipmentName]").val(data.equipmentName);
            $("input[name=equipmentModel]").val(data.equipmentModel);
            $("input[name=meteringUnit]").val(data.meteringUnit);
            // $("input[name=useDepartment]").val(data.useDepartment);
            // $("input[name=remark]").val(data.remark);

        }
    }

    function submitHandler() {

        //  var arrivalAmount= parseFloat($('input[name="arrivalAmount"]').val());
        //  var claimAmount= parseFloat($('input[name="claimAmount"]').val());
        //  console.log(arrivalAmount);
        //  console.log(claimAmount);
        //  console.log(claimAmount>arrivalAmount);
        // if(claimAmount>arrivalAmount){
        //   //  alert("已认领金额不能大于到账金额");
        //   return  opt.modal.alertWarning("已认领金额不能大于到账金额");
        // }

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/add", $('#task-form-complete').serialize());
        }
    }
</script>

</@footer>
</@pageTheme>